﻿class DefaultCell extends BaseCell {
    keepAlive = [2, 3];
    getBorn = [3];

    //keepAlive = [1,2,3,4,5];
    //getBorn = [3];


    CalculateNextState() {
        //this.NextState = this.State;
        //return;

        this.NextState = CellState.Dead;
        var nrOfNeighboursAlive = this.grid.GetNrOfNeighbourCellsOfState(CellState.Alive, this.x, this.y);
        switch (this.State) {
            case CellState.Alive:
                if (this.keepAlive.indexOf(nrOfNeighboursAlive) != -1)
                    this.NextState = CellState.Alive;
                break;
            case CellState.Dead:
                if (this.getBorn.indexOf(nrOfNeighboursAlive) != -1)
                    this.NextState = CellState.Alive;                   
                break;
            
        }
        if (this.NextState != this.State) {
            var nrOfNeighboursAlive2 = this.grid.GetNrOfNeighbourCellsOfState(CellState.Alive, this.x, this.y);
        }
    }
   
}